home *** CD-ROM | disk | FTP | other *** search
- global gpRandomSoundList, gpRandomSoundCount
-
- on initRandomSounds theSoundList
- set gpRandomSoundList to theSoundList
- set gpRandomSoundCount to count(theSoundList)
- set the timeoutMouse to 1
- set the timeoutKeyDown to 1
- end
-
- on enableRandomSounds
- set the timeoutLength to (random(20) + 60) * 60
- set the timeoutScript to "playRandomSound"
- putDebug("enableRandomSounds" && the timeoutLength / 60)
- end
-
- on disableRandomSounds
- set the timeoutScript to EMPTY
- putDebug("disableRandomSounds")
- end
-
- on playRandomSound
- set theRandomSoundIndex to random(gpRandomSoundCount)
- set theSoundName to getAt(gpRandomSoundList, theRandomSoundIndex)
- if (soundBusy(1) = 0) and (soundBusy(2) = 0) then
- puppetSound(theSoundName)
- putDebug("playRandomSound" && theSoundName && theRandomSoundIndex)
- updateStage()
- end if
- enableRandomSounds()
- end
-